<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.anhry.app.safety.util.Util"/>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>菜单编辑</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/check_jquery.js"></script>
	<script type="text/javascript" src="<%=path%>/js/selected.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/multipleBox.js"></script>
	<script type="text/javascript">
		function changeEconomy(rid){
	   		var urls='<%=basePath%>/enterprise/ctype_loadEconomy.action?economyId='+rid
	   		buildSelect(rid, 'economyId',urls);
	   	}
	   	$(function(){
	   		initSelArray('economyId');
			var v1 = '${corpType.economyParentId}';
			var v2 = '${corpType.economyId}';
			if(null!=v1 && v1!=""){
				changeEconomy(v1);
			}
	   		if(v2!=null && v2!=""){
	   			selected('economyId',v2);	//加载选中单位
	   		}
		});
		
		function checkMultiple(){
			var selectBox = document.getElementById('deptSelect');
			var haveDept = "";
			if(selectBox.options != null && selectBox.options.length != 0){
				for(var i=0;i<selectBox.options.length;i++){
					var tKey = selectBox.options[i].value;
					haveDept += tKey + ","; 					
				}
				if(haveDept.length>0){
					haveDept = haveDept.substring(0,haveDept.length-1);
				}
			}
			document.form1.quDeptIds.value=haveDept;
		}
	</script>
  </head>
  
  <body>
	<div  class="body-box">
		<div class="map">
			<div class="map_con">
				您当前的位置：企业分类管理 &gt; 企业类型维护 &gt; 企业类型编辑
			</div>
		</div>
		<div id="container">
			<form action="<%=basePath%>/enterprise/ctype_save.action" method="post" name="form1" onsubmit="checkMultiple();">
		    	<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td colspan="4" class="title_li">企业类型编辑</td>
					</tr>
					<s:if test="%{fun.id!=null}">
						<tr>
							<td width="15%" class="title_td">类型ID：</td>
							<td>&nbsp;${corpType.id}</td>
						</tr>
					</s:if>
					<tr>
						<td width="15%" class="title_td">父类型名称：</td>
						<td>&nbsp;${corpType.typeParentName}</td>
					</tr>
					<tr>
						<td class="title_td">父类型ID：</td>
						<td><input type="text" name="typeParentId" id="bnumber0" class="info_input" value="${corpType.typeParentId}"/><span class="note4">*</span><span style="color: gray">&nbsp;(请勿随意修改)</span></td>
					</tr>
					<tr>
						<td class="title_td">类型名称：</td>
						<td><input type="text" name="typeName" class="info_input" value="${corpType.typeName}" id="bit1"/><SPAN class="note4">*</SPAN></td>
					</tr>
					<s:if test="%{corpType.typeParentId!=0}">
						<tr>
							<td class="title_td">市行业主管部门：</td>
							<td><s:select list="deptList" name="unitId" value="%{corpType.unitId}" listKey="id" listValue="deptName" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect3"></s:select><SPAN class="note4">*</SPAN> </td>
						</tr>
						<tr>
							<td class="title_td">县(市、区)、开发区安监局主管部门：</td>
								<td>
									<table border="0" cellspacing="0" cellpadding="0"  width="100%"  style="float:left;">
									<tr>
										<td width="45%" style="border:none">
										  县(市、区)、开发区科室：<br>
											 <table width="99%" height="200" border="0" cellpadding="1" cellspacing="0" bgcolor="#F7F7F7" style="font-size:10pt">
												  <tr height="100%">
													<td width="100%" height="100%" align="left" valign="middle">
														<select style="width:100%;height:100%" name="allDept" size="17" ondblclick="selectMove(document.form1.allDept,document.form1.haveDept,'左')">																		                                      	
					                                    	<s:if test="quList.size>0">
					                                    	<s:iterator id="obj" value="quList">
					                                      		<option value="${obj.id }">
					                                      			${obj.deptParentName }安监局——${obj.deptName}
					                                      		</option>	
					                                      	</s:iterator>
					                                      	</s:if>
					                                    </select>
				                                    </td>
												  </tr>
											</table>
										</td>
										<td width="10%" style="text-align:center;border-top:none;border-bottom:none;"><br>
									    <a href="javascript:selectMove(document.form1.allDept,document.form1.haveDept,'左')">添加</a><br>
									    <a href="javascript:selectMove(document.form1.haveDept,document.form1.allDept,'右')">删除</a><br>
									    <a href="javascript:moveAll(document.form1.allDept,document.form1.haveDept);">全部添加</a><br>
									    <a href="javascript:moveAll(document.form1.haveDept,document.form1.allDept);">全部删除</a></td>
										<td width="45%" style="border:none">
										  已选：<br>
											 <table width="99%" height="200" border="0" cellpadding="1" cellspacing="0" bgcolor="#F7F7F7" style="font-size:10pt">
												  <tr height="100%">
													<td width="100%" height="100%" align="left" valign="middle">
														<select id="deptSelect" style="width:100%;height:100%" name="haveDept" size="17" ondblclick="selectMove(document.form1.haveDept,document.form1.allDept,'右')" >											                                     
					                                    	<s:if test="haveList.size>0">
					                                    	<s:iterator id="obj" value="haveList">
					                                      		<option value="${obj.id }">
					                                      			${obj.deptParentName }安监局——${obj.deptName}
					                                      		</option>	
					                                      	</s:iterator>
					                                      	</s:if>
					                                    </select>
				                                    </td>
												  </tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td class="title_td">所属国民经济行业分类：</td>
							<td>
								<s:select list="economyList" name="economyParentId" value="%{corpType.economyParentId}" listKey="id" listValue="typeName" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect1" onchange="changeEconomy(this.value);"></s:select><SPAN class="note4">*</SPAN>
								-<s:select list="#{}" name="economyId" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect2"></s:select><SPAN class="note4">*</SPAN>
							</td>
						</tr>
					</s:if>
					<tr>
						<td colspan="4" align="center">
							<center>
							<input type="submit" name="btntj" class="link_input" id="btnSubmit" value="提 交">
							<input type="reset" name="btnset" class="link_input" id="btnset" value="重 置">
							<input type="button" name="btn1" class="link_input" id="btnset1" value="返 回" onclick="window.location.href='<%=basePath%>/enterprise/ctype_list.action'">
							</center>
						</td>
					</tr>
				</table>
				<input id="id" type="hidden" name="id" value="${corpType.id}"/>
				<input type="hidden" name="quDeptIds" value=""/>
			</form>
		</div>
	</div>
  </body>
</html>
